package com.demo;

import com.demo.component.BeanLifeComponent;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @Author YuanYuan
 * @Date 2023/2/10
 * @Time 15:25
 */
public class Demo3 {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-config.xml");
        BeanLifeComponent beanLifeComponent = applicationContext.getBean("beanLifeComponent",BeanLifeComponent.class);
        System.out.println("使用Bean");
        //销毁Bean
        applicationContext.destroy();
    }
}
